package com.ningxia.water.service.impl;

import com.ningxia.water.entity.ZtAreaInfo;
import com.ningxia.water.entity.ZtCityInfo;
import com.ningxia.water.entity.ZtDistrictInfo;
import com.ningxia.water.mapper.ZtAreaInfoMapper;
import com.ningxia.water.mapper.ZtCityInfoMapper;
import com.ningxia.water.mapper.ZtDistrictInfoMapper;
import com.ningxia.water.service.IZtCityInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningxia.water.vo.out.ZoneVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author hz
 * @since 2021-05-14
 */
@Service
public class ZtCityInfoServiceImpl extends ServiceImpl<ZtCityInfoMapper, ZtCityInfo> implements IZtCityInfoService {

    @Autowired
    private ZtDistrictInfoMapper districtInfoMapper;

    @Autowired
    private ZtAreaInfoMapper areaInfoMapper;

    @Autowired
    private ZtCityInfoMapper cityInfoMapper;

    @Override
    public Integer findByCityId(Integer cityId) {
        Integer count = districtInfoMapper.findByCityId(cityId);
        count += areaInfoMapper.findByCityId(cityId);
        return count;
    }

    @Override
    public List<ZtDistrictInfo> getAllDistrict(Integer cityId) {
        return cityInfoMapper.getAllDistrict(cityId);
    }

    @Override
    public List<ZtAreaInfo> getAllArea(Integer cityId) {
        return cityInfoMapper.getAllArea(cityId);
    }

    @Override
    public List<ZoneVo> getCityInfos() {
        return cityInfoMapper.getCityInfos();
    }
}
